home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcr / pcr4_4.lha / DIST / makefile next >
Makefile  |  1992-04-17  |  14KB  |  561 lines

  1. #
  2. # PCR top-level makefile
  3. #
  4. # Demers, March 12, 1990 3:29:14 pm PST
  5. # AIshigo, December 14, 1988 12:48:51 pm PST
  6. # Weiser, December 1, 1989
  7. # CHauser, December 14, 1989 10:11:44 am PST
  8. #
  9.  
  10.  
  11. #
  12. # The following should be set to reflect local installation site:
  13. # For testing purposes, INSTALL_MAN could be set to ${XR_HOME}/testman.  
  14. #
  15. # XR_HOME should almost always be set to the full pathname expansion
  16. # of "..", i.e. the parent of the directory containing this makefile.
  17. #
  18. # (beware of using paths containing .. directly in XR_HOME,
  19. # or INSTALL_MAN.  These are expanded in various contexts where .. will vary.
  20. #
  21.  
  22. # XR_HOME = /pseudo/xrhome/
  23. XR_HOME = /net/lane/everett/xrhome/
  24. INSTALL_MAN = ${XR_HOME}/testmanl
  25.  
  26. #
  27. # If the following changes, fix CPDIFF in makefile.common to track it
  28. #
  29. UTILITIES_DIR = ${XR_HOME}/UTILITIES
  30. CPDIFF = ${UTILITIES_DIR}/copyifdifferent
  31. SHAR = ${UTILITIES_DIR}/makescript
  32.  
  33. #
  34. # The file 'makefile.version' is created automatically, but you can edit it
  35. #   if you wish.  It must define
  36. #
  37. #   VERSION_MAJOR = xx
  38. #   VERSION_MINOR = yy
  39. #   VERSION_LOCAL = zz (distributed version) or "X" (at Xerox) 
  40. #   VERSION_DEV = ".dev" (development version) or empty
  41. #
  42.  
  43. include makefile.version
  44.  
  45. VERSION = ${VERSION_MAJOR}_${VERSION_MINOR}.${VERSION_LOCAL}${VERSION_DEV}
  46.  
  47. #
  48. # Kludge to determine what the next major and minor release names are
  49. #
  50. NEWMINORVERSION = ${VERSION_MAJOR}_`expr ${VERSION_MINOR} + 1`.${VERSION_LOCAL}
  51.  
  52. NEWMAJORVERSION = `expr ${VERSION_MAJOR} + 1`_${VERSION_MINOR}.${VERSION_LOCAL}
  53.  
  54.  
  55. #
  56. # To add a component, change these and change CONFIG_COMPONENTS
  57. #   in the configuration targets below, where appropriate.
  58. #
  59. # To add a configuration, change these and add the appropriate target below.
  60. #
  61.  
  62. ALL_CONFIGS = OptThreads Threads
  63. ALL_COMPONENTS = boot debugnub dylibload gc interp loading package pcr threads
  64. SUBDIRS = BIN INCLUDE LIB MAN SRC
  65. CLEAN_SUBDIRS = BIN INCLUDE LIB SRC
  66.  
  67. TARFILE = pcr.tar
  68. SHARFILE = pcr.shar
  69.  
  70.  
  71. ############################################################
  72. #
  73. #
  74. # Public targets:
  75. #
  76. #
  77. ############################################################
  78.  
  79. #
  80. # Usage: (no target) do nothing.
  81. #
  82.  
  83. notarget:
  84.     echo "Please read instructions on how to use this stuff."
  85.  
  86.  
  87. #
  88. # Usage: make install
  89. #
  90. # (that's a mistake)
  91. #
  92. install:
  93.     echo "You must use install1 and install2"
  94.  
  95. #
  96. # Usage: make install1
  97. #
  98. # renames the distribution directory to the INSTALLED directory and 
  99. #    builds all the configs
  100. #    
  101. install1:
  102.     name1=`pwd`; name2=`basename $$name1`; if [ $$name2 != DIST ]; then \
  103.         echo "Must install from ${XR_HOME}/DIST only" ; \
  104.         exit 1 ; \
  105.     fi
  106.     ${MAKE} -${MAKEFLAGS} all
  107.     mv ../DIST ../${VERSION}
  108.     ( cd .. ; rm -f INSTALLED ; ln -s ${VERSION} INSTALLED )
  109.  
  110. #
  111. # Usage: make install2
  112. #
  113. # installs the man pages ...
  114. #
  115.  
  116. install2:
  117.     for dir in ${ALL_COMPONENTS}; do \
  118.         (cd $$dir; $(MAKE) -${MAKEFLAGS} \
  119.             MAN_DIR=${INSTALL_MAN} MAKEPUBLIC=TRUE \
  120.             man); \
  121.         done
  122.  
  123.  
  124. #
  125. # Usage:
  126. #   make bounce
  127. #   make bounce_local
  128. #
  129. # (these are equivalent)
  130. #
  131. # Bounce, incrementing local version.
  132. #   For use in making local changes to distributed versions.
  133. #   Do this only from ${XR_HOME}/DEVELOPMENT
  134. #
  135.  
  136. bounce bounce_local: bounceCheckInner
  137.     @if [ "x${VERSION_LOCAL}" = xX ]; then \
  138.         echo "Use \"make bounce_major\" or \"make bounce_minor\"" ; \
  139.         exit 1 ; \
  140.     fi
  141.     ${MAKE} -${MAKEFLAGS} copyInner
  142.     ( cd ../TEMP; \
  143.         ${MAKE} -${MAKEFLAGS} \
  144.             "VERSION_MAJOR=${VERSION_MAJOR}" \
  145.             "VERSION_MINOR=${VERSION_MINOR}" \
  146.             "VERSION_LOCAL=`expr ${VERSION_LOCAL} + 1`" \
  147.             "VERSION_DEV=" \
  148.             versionInner ; \
  149.         ${MAKE} -${MAKEFLAGS} \
  150.             all ; \
  151.         ${MAKE} -${MAKEFLAGS} \
  152.             installSelfInner \
  153.     )
  154.  
  155. #
  156. # Usage: make development
  157. #
  158. # Make a development version from an installed one.
  159. #   Generally used immediately after extracting a distribution.
  160. #
  161. development: developmentCheckInner
  162.     ${MAKE} -${MAKEFLAGS} copyInner
  163.     ( cd ../TEMP; \
  164.         ${MAKE} -${MAKEFLAGS} \
  165.             "VERSION_MAJOR=${VERSION_MAJOR}" \
  166.             "VERSION_MINOR=${VERSION_MINOR}" \
  167.             "VERSION_LOCAL=${VERSION_LOCAL}" \
  168.             "VERSION_DEV=.dev" \
  169.             versionInner ; \
  170.         ${MAKE} -${MAKEFLAGS} \
  171.             installSelfInner ; \
  172.     )
  173.  
  174. #
  175. # Usage: make <config-name>
  176. #
  177. # build named configuration
  178. # store results in ../BIN/config-name, ../LIB/config-name
  179. #
  180.  
  181. Threads:
  182.     ${MAKE} -${MAKEFLAGS} \
  183.     "CONFIG=Threads" \
  184.     "CONFIG_COMPONENTS=boot debugnub dylibload gc interp loading package pcr threads" \
  185.     "CONFIG_CFLAGS=-g -DSUNOS4X -DTHREADS -DFINALIZE -DREALFREE" \
  186.     "CONFIG_AFLAGS=-DSUNOS4X -DTHREADS -DFINALIZE -DREALFREE" \
  187.     configInner
  188.  
  189. OptThreads:
  190.     ${MAKE} -${MAKEFLAGS} \
  191.     "CONFIG=OptThreads" \
  192.     "CONFIG_COMPONENTS=boot debugnub dylibload gc interp loading package pcr threads" \
  193.     "CONFIG_CFLAGS=-O2 -DSUNOS4X -DTHREADS -DFINALIZE -DREALFREE" \
  194.     "CONFIG_AFLAGS=-DSUNOS4X -DTHREADS -DFINALIZE -DREALFREE" \
  195.     configInner
  196.  
  197. #
  198. # Usage: make all
  199. #
  200. # make all configs
  201. #
  202. all: ${ALL_CONFIGS}
  203.  
  204.  
  205. #
  206. # Usage: make clean
  207. #
  208. clean:
  209.     for dir in ${ALL_COMPONENTS}; do \
  210.         (cd $$dir; make clean); \
  211.         done
  212.     rm -rf LIB/* BIN/* INCLUDE/* SRC/* MAN/* *.o *.a *.bak *~
  213.  
  214. ##################################################################
  215. #
  216. #
  217. # "private" targets -- for use before distribution
  218. #
  219. #
  220. ##################################################################
  221.  
  222. #
  223. # Usage: make bounce_major
  224. #
  225. # Bounce, incrementing major version.
  226. #
  227. #   Do this only from ${XR_HOME}/DEVELOPMENT
  228. #
  229.  
  230. bounce_major: bounceCheckInner
  231.     @if [ "x${VERSION_LOCAL}" != xX ]; then \
  232.         echo "Please don't do major bounce of distribution" ; \
  233.         exit 1 ; \
  234.     fi
  235.     @if [ -h ${NEWMAJORVERSION} -o -d ${NEWMAJORVERSION} -o -f \
  236.     ${NEWMAJORVERSION} ] ; then \
  237.         echo "${NEWMAJORVERSION} directory already exists" ; \
  238.         exit 1 ; \
  239.     fi
  240.     ${MAKE} -${MAKEFLAGS} copyInner
  241.     ( cd ../TEMP; \
  242.         ${MAKE} -${MAKEFLAGS} \
  243.             "VERSION_MAJOR=`expr ${VERSION_MAJOR} + 1`" \
  244.             "VERSION_MINOR=0" \
  245.             "VERSION_LOCAL=X" \
  246.             "VERSION_DEV=" \
  247.             versionInner ; \
  248.         ${MAKE} -${MAKEFLAGS} \
  249.             all ; \
  250.         ${MAKE} -${MAKEFLAGS} \
  251.             installSelfInner \
  252.     )
  253.     ${MAKE} -${MAKEFLAGS} \
  254.         "VERSION_MAJOR=`expr ${VERSION_MAJOR} + 1`" \
  255.         "VERSION_MINOR=0" \
  256.         "VERSION_LOCAL=X" \
  257.         versionInnerDev 
  258.  
  259. #
  260. # Usage: make bounce_minor
  261. #
  262. # Bounce, incrementing minor version.
  263. #
  264. #   Do this only from ${XR_HOME}/DEVELOPMENT
  265. #
  266.  
  267. bounce_minor: bounceCheckInner
  268.     @if [ "x${VERSION_LOCAL}" != xX ]; then \
  269.         echo "Please don't do minor bounce of distribution" ; \
  270.         exit 1 ; \
  271.     fi
  272.     @if [ -h ${NEWMINORVERSION} -o -d ${NEWMINORVERSION} -o -f \
  273.     ${NEWMINORVERSION} ] ; then \
  274.         echo "${NEWMINORVERSION} directory already exists" ; \
  275.         exit 1 ; \
  276.     fi
  277.     ${MAKE} -${MAKEFLAGS} copyInner
  278.     ( cd ../TEMP; \
  279.         ${MAKE} -${MAKEFLAGS} \
  280.             "VERSION_MAJOR=${VERSION_MAJOR}" \
  281.             "VERSION_MINOR=`expr ${VERSION_MINOR} + 1`" \
  282.             "VERSION_LOCAL=X" \
  283.             "VERSION_DEV=" \
  284.             versionInner ; \
  285.         ${MAKE} -${MAKEFLAGS} \
  286.             all ; \
  287.         ${MAKE} -${MAKEFLAGS} \
  288.             installSelfInner \
  289.     )
  290.     ${MAKE} -${MAKEFLAGS} \
  291.         "VERSION_MAJOR=${VERSION_MAJOR}" \
  292.         "VERSION_MINOR=`expr ${VERSION_MINOR} + 1`" \
  293.         "VERSION_LOCAL=X" \
  294.         versionInnerDev 
  295.     
  296.  
  297. ############################################################
  298. #
  299. #
  300. # Distribution targets:
  301. #
  302. #
  303. ############################################################
  304.  
  305. #
  306. # Usage: make tar
  307. #
  308. # Make a tar file of an INSTALLED tree
  309. #
  310. tar: 
  311.     @if [ "x${VERSION_DEV}" != x ]; then \
  312.         echo "Run \"make tar\" from installed directory" ; \
  313.         exit 1 ; \
  314.     fi
  315.     ${MAKE} -${MAKEFLAGS} tarInner
  316.  
  317. testtar:
  318.     ${MAKE} -${MAKEFLAGS} tarInner
  319.  
  320. tarInner:
  321.     @if [ -h ../DIST -o -d ../DIST -o -f ../DIST ] ; then \
  322.         echo "DIST directory already exists" ; \
  323.         exit 1 ; \
  324.     fi
  325.     ${MAKE} -${MAKEFLAGS} copyInner
  326.     ( cd ../TEMP; \
  327.         echo "VERSION_MAJOR" = ${VERSION_MAJOR} > makefile.version ; \
  328.         echo "VERSION_MINOR" = ${VERSION_MINOR} >> makefile.version ; \
  329.         echo "VERSION_LOCAL" = 0 >> makefile.version ; \
  330.         echo "VERSION_DEV" = ${VERSION_DEV} >> makefile.version ; \
  331.         ${MAKE} -${MAKEFLAGS} clean )
  332.     rm -rf ../DIST
  333.     mv ../TEMP ../DIST
  334.     ( cd ../UTILITIES ; ${MAKE} -${MAKEFLAGS} clean )
  335.     ( fullname=`pwd`; name=`basename $$fullname`; cd .. ; tar cvf ${TARFILE}_$${name}_`date '+%m-%d-%y-%H:%M:%S'` README ./UTILITIES ./DIST ./EXTRAS)
  336.     rm -rf ../DIST
  337.     
  338. doExcludeFile:
  339.     @ls -d ./OLD_PCR_* ./SAV* ./*.co ./*/SAV*  ./*/*.Z > excludeFile
  340.     @echo ./excludeFile >> excludeFile
  341.     @echo ----- Excluding `cat excludeFile`
  342.  
  343. #
  344. # Usage: make shar
  345. #
  346. # Make a shar file of an INSTALLED tree
  347. #
  348. shar: ${UTILITIES_DIR}/${SHAR}
  349.     @if [ "x${VERSION_DEV}" != x ]; then \
  350.         echo "Run \"make tar\" from installed directory" ; \
  351.         exit 1 ; \
  352.     fi
  353.     @if [ -h ../DIST -o -d ../DIST -o -f ../DIST ] ; then \
  354.         echo "DIST directory already exists" ; \
  355.         exit 1 ; \
  356.     fi
  357.     ${MAKE} -${MAKEFLAGS} copyInner
  358.     ( cd ../TEMP; \
  359.         echo "VERSION_MAJOR" = ${VERSION_MAJOR} > makefile.version ; \
  360.         echo "VERSION_MINOR" = ${VERSION_MINOR} >> makefile.version ; \
  361.         echo "VERSION_LOCAL" = 0 >> makefile.version ; \
  362.         echo "VERSION_DEV" = ${VERSION_DEV} >> makefile.version ;\
  363.         ${MAKE} -${MAKEFLAGS} clean )
  364.     rm -rf ../DIST
  365.     mv ../TEMP ../DIST
  366.     ( cd ../UTILITIES ; ${MAKE} -${MAKEFLAGS} cleancopy )
  367.     ( cd ..; \
  368.         rm -f ${SHARFILE} ; \
  369.         ${SHAR} -k -v ${VERSION} -o ${SHARFILE}_`date '+%m-%d-%y-%H:%M:%S'` README ./UTILITIES ./DIST )
  370.     rm -rf ../DIST
  371.  
  372.  
  373. ##################################################################
  374. #
  375. #
  376. # "internal" targets -- for recursive use ONLY
  377. #
  378. #
  379. ##################################################################
  380.  
  381. #
  382. # make ${UTILITIES_DIR}/${CPDIFF}
  383. #
  384.  
  385. ${UTILITIES_DIR}/${CPDIFF}:
  386.     ( cd ${UTILITIES_DIR}; make ${CPDIFF} )
  387.     
  388. ${UTILITIES_DIR}/${SHAR}:
  389.     ( cd ${UTILITIES_DIR}; make ${SHAR} )
  390.  
  391.  
  392. #
  393. # make CONFIG=... CONFIG_COMPONENTS=... CONFIG_CFLAGS=... configInner
  394. #
  395.  
  396. CONFIG_DIR = ${CONFIG}${TARGET_MACH}
  397.  
  398. configInner: ${UTILITIES_DIR}/${CPDIFF}
  399.     @if [ "x${CONFIG}" = x -o "x${CONFIG_COMPONENTS}" = x \
  400.         -o "x${CONFIG_COMPONENTS}" = x ]; then \
  401.         echo "Use \"make <config_name>\" NOT \"make configInner\"" ; \
  402.         exit 1 ; \
  403.     fi
  404.     echo CONFIG= ${CONFIG} > makefile.config.2
  405.     echo MACHINE= ${TARGET_MACH} >> makefile.config.2
  406.     echo STD_INCLUDES= -IINCLUDE -I../INCLUDE >> makefile.config.2
  407.     echo CONFIG_CFLAGS= ${CONFIG_CFLAGS} >> makefile.config.2
  408.     echo CONFIG_AFLAGS= ${CONFIG_AFLAGS} >> makefile.config.2
  409.     echo VERSION= ${VERSION} >> makefile.config.2
  410.     rm -rf LIB/${CONFIG_DIR}
  411.     mkdir LIB/${CONFIG_DIR}
  412.     rm -rf BIN/${CONFIG_DIR}
  413.     mkdir BIN/${CONFIG_DIR}
  414.     rm -rf OBJtemp; mkdir OBJtemp
  415.     for dir in ${CONFIG_COMPONENTS}; do \
  416.         (echo COMPONENT= $$dir > makefile.config); \
  417.         (cat makefile.config.2 >> makefile.config); \
  418.         (${CPDIFF} makefile.config $$dir/makefile.config); \
  419.         done
  420.     for dir in ${ALL_COMPONENTS}; do \
  421.         (cd $$dir; $(MAKE) -${MAKEFLAGS} MAKEPUBLIC=TRUE \
  422.             include); \
  423.         done
  424.     for dir in ${CONFIG_COMPONENTS}; do \
  425.         (cd $$dir; $(MAKE) -${MAKEFLAGS} MAKEPUBLIC=TRUE depend; \
  426.             $(MAKE) -${MAKEFLAGS} MAKEPUBLIC=TRUE \
  427.             obj); \
  428.         done
  429.     for dir in ${CONFIG_COMPONENTS}; do \
  430.         (cd $$dir; $(MAKE) -${MAKEFLAGS} MAKEPUBLIC=TRUE depend; \
  431.             $(MAKE) -${MAKEFLAGS} MAKEPUBLIC=TRUE \
  432.             MAN_DIR=../MAN \
  433.             man); \
  434.         done
  435.     echo "extern char" > OBJtemp/XRRoot2.c
  436.     cat OBJtemp/version_string_names >> OBJtemp/XRRoot2.c
  437.     echo "*(XR_versions[]);" >> OBJtemp/XRRoot2.c
  438.     echo "char *(XR_versions[]) = {" >> OBJtemp/XRRoot2.c
  439.     cat OBJtemp/version_string_addresses >> OBJtemp/XRRoot2.c
  440.     echo "    0 };" >> OBJtemp/XRRoot2.c
  441.     ( cd OBJtemp; \
  442.         ${CC} -c ${CONFIG_CFLAGS} XRRoot2.c; \
  443.         /bin/ld -r -o XRRoot.o ThreadsRoot.o XRRoot2.o; \
  444.         rm -f ThreadsRoot.o XRRoot2.o; \
  445.         ar r xr.a *.o; \
  446.         mv xr.a XRRoot.o ../LIB/${CONFIG_DIR} )
  447.     ( cd LIB/${CONFIG_DIR}; ranlib xr.a )
  448.     rm -rf OBJtemp
  449.     rm -rf LIBAtemp; mkdir LIBAtemp
  450.     for dir in ${CONFIG_COMPONENTS}; do \
  451.         (cd $$dir; $(MAKE) -${MAKEFLAGS} MAKEPUBLIC=TRUE \
  452.             lib liba bin src); \
  453.         done
  454.     ( cd LIBAtemp; ar r libxr.a `ls`; mv libxr.a ../LIB/${CONFIG_DIR} )
  455.     ( cd LIB/${CONFIG_DIR}; ranlib libxr.a )
  456.     rm -rf LIBAtemp
  457.     rm -f makefile.config makefile.config.2
  458.     ln BIN/${CONFIG_DIR}/PortableCommonRuntime OLD_PCR_`date '+%m-%d-%y-%H:%M:%S'`
  459.  
  460. #
  461. # make VERSION_MAJOR=... VERSION_MINOR=... VERSION_LOCAL=... 
  462. #         VERSION_DEV=... versionInner
  463. #
  464. # Create a local makefile.version
  465. #
  466. versionInner:
  467.     echo "VERSION_MAJOR" = ${VERSION_MAJOR} > makefile.version
  468.     echo "VERSION_MINOR" = ${VERSION_MINOR} >> makefile.version
  469.     echo "VERSION_LOCAL" = ${VERSION_LOCAL} >> makefile.version
  470.     echo "VERSION_DEV" = ${VERSION_DEV} >> makefile.version
  471.     ${MAKE} -${MAKEFLAGS} clean
  472.     
  473. #
  474. # make versionInnerDev
  475. #
  476. # Updates the makefile.version for the development directory
  477. #
  478. versionInnerDev:
  479.     echo "VERSION_MAJOR" = ${VERSION_MAJOR} > makefile.version
  480.     echo "VERSION_MINOR" = ${VERSION_MINOR} >> makefile.version
  481.     echo "VERSION_LOCAL" = ${VERSION_LOCAL} >> makefile.version
  482.     echo "VERSION_DEV" = .dev >> makefile.version
  483.  
  484. #
  485. # make copyInner
  486. #
  487. # Copy this subtree to ../TEMP
  488. #
  489. copyInner: doExcludeFile
  490.     rm -rf ../TEMP; mkdir ../TEMP
  491.     tar cFFfX - excludeFile . | ( cd ../TEMP; tar xvf - )
  492.  
  493. # copyInner:
  494. #     rm -rf ../TEMP; cp -r -p . ../TEMP
  495.  
  496. #
  497. # make installSelfInner
  498. #
  499. # rename self (../TEMP) to correct thing as determined from VERSION variables.
  500. #
  501. installSelfInner:
  502.     @( dir=`pwd`; \
  503.         if [ "`basename $$dir`" != TEMP ]; then \
  504.             echo "BUG in makefile: installSelfInner botch" ; \
  505.             exit 1 ; \
  506.         fi \
  507.     )
  508.     @if [ -h ${VERSION} -o -d ${VERSION} -o -f ${VERSION} ] ; then \
  509.         echo "${VERSION} directory already exists" ; \
  510.         exit 1 ; \
  511.     fi
  512.     if [ "x${VERSION_DEV}" = x ] ; then \
  513.         if [ -d ../${VERSION} ] ; then \
  514.             echo "Aborting bounce, directory ${VERSION} already exists." ; \
  515.             exit 1; \
  516.         fi ; \
  517.         mv ../TEMP ../${VERSION} ; \
  518.         rm -f ../INSTALLED ; \
  519.         ( cd ..; ln -s ${VERSION} INSTALLED ) ; \
  520.     else \
  521.         rm -f ../DEVELOPMENT ; \
  522.         mv ../TEMP ../DEVELOPMENT ; \
  523.     fi
  524.  
  525. #
  526. # Validity check for "make development"
  527. #
  528. developmentCheckInner:
  529.     @if [ "x${VERSION_DEV}" != x ]; then \
  530.         echo "Run \"make development\" from installed directory" ; \
  531.         exit 1 ; \
  532.     fi
  533.     @if [ -h ../DEVELOPMENT -o -f ../DEVELOPMENT \
  534.             -o -d ../DEVELOPMENT ] ; then \
  535.         echo "DEVELOPMENT directory already exists" ; \
  536.         exit 1 ; \
  537.     fi
  538.  
  539. #
  540. # Validity check for "make bounce_xxx"
  541. #
  542. bounceCheckInner:
  543.     @if [ "x${VERSION_DEV}" = x ]; then \
  544.         echo "Run \"make bounce_xxx\" from development directory" ; \
  545.         exit 1 ; \
  546.     fi
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.